	//---------------------------------------------------------------------
	// Includes
	//---------------------------------------------------------------------		
	#include <Geometry/Light.hpp>	
	#include <Rendering/Renderer.hpp>
	
namespace Geometry {
	
	//---------------------------------------------------------------------			
	// Light methods
	//---------------------------------------------------------------------		
	Light::Light( const Vector::Vector3& p, const Vector::Vector3& d):
	Rendering::IPointOfView() {
		// Initialise position & direction
		Vector::Copy3(position,p);
		Vector::Copy3(direction,d);
	}
	//---------------------------------------------------------------------		
	Light::~Light() {
		
	}
	//---------------------------------------------------------------------		
	TLightPointer Light::CreateLight(const Vector::Vector3& position, const Vector::Vector3& direction) {
		return TLightPointer(new Light(position, direction));
	}
	//---------------------------------------------------------------------		
	void Light::UpdateProjectionMatrix() {	
		// TODO define aspect
		Matrix::Perspective4(projectionMatrix, fieldOfView, 1.f, nearPlane, farPlane);
		//Matrix::LinearPerspective4(projectionMatrix, fieldOfView, 1.f, nearPlane, farPlane);
	}
	//---------------------------------------------------------------------
	void Light::UpdateViewMatrix() {
		// Update light	transform 
		Vector::Vector3 lightTarget = { position[0] + direction[0],
								    	position[1] + direction[1],
										position[2] + direction[2] };
		float lightUp[] = {0.f, 1.f, 0.f};
		// TODO set up vector carefully (cross product may be not valid)
		Matrix::LookAt4(viewMatrix, position, lightTarget, lightUp);
	}
	//---------------------------------------------------------------------
	void Light::Transform(const Matrix::Matrix4& transformation) {
		//TODO remove or modified
	}
	//---------------------------------------------------------------------
	Vector::Vector3& Light::GetPosition() {
		return position;
	}
	//---------------------------------------------------------------------
	Vector::Vector3& Light::GetDirection() {
		return direction;
	}
}
